JavaScript Trim end

trimEnd() removes whitespace from the end of a string only, leaving the start intact. It returns a new string.

Syntax

str.trimEnd()

Examples

Input Arguments Output
" hi " " hi"

Try it live

Type your input and see Trim end transform it instantly.

Description: Removes whitespace from the end of the string.

Example: 'cinnamon roll '.trimEnd() => 'cinnamon roll'

Want to go further? Chain Trim end with other functions in the visual Playground — pipe one output into the next and watch your data transform.

Related functions

© 2026 Heifara Buval